#include "stdafx.h"
#include "CDevice.h"

bool CMouse::IsMouseDown(MouseButton mouseButton)
{
	switch(mouseButton)
	{
	case MouseButtonLeft:
		return (::GetKeyState(VK_LBUTTON) & 0x80) != 0;
	case MouseButtonRight:
		return (::GetKeyState(VK_RBUTTON) & 0x80) != 0;
	case MouseButtonMiddle:
		return (::GetKeyState(VK_MBUTTON) & 0x80) != 0;
	case MouseButtonBack:
		return (::GetKeyState(VK_XBUTTON1) & 0x80) != 0;
	case MouseButtonForward:
		return (::GetKeyState(VK_XBUTTON2) & 0x80) != 0;
	default:
		throw CIllegalArgumentException();
	}
}
bool CMouse::IsMouseUp(MouseButton mouseButton)
{
	return !IsMouseDown(mouseButton);
}

bool CKeyboard::IsKeyDown(KeyCode keyCode)
{
	return (::GetKeyState(keyCode) & 0x80) != 0;
}
bool CKeyboard::IsKeyUp(KeyCode keyCode)
{
	return !IsKeyDown(keyCode);
}
bool CKeyboard::IsKeyLock(KeyCode keyCode)
{
	return (::GetKeyState(keyCode) & 0x8) != 0;
}

CSizeInt32 CScreen::GetSize()
{
	return CSizeInt32(::GetSystemMetrics(SM_CXSCREEN), 
		::GetSystemMetrics(SM_CYSCREEN));
}

CSizeInt32 CScreen::GetClientSize()
{
	return CSizeInt32(::GetSystemMetrics(SM_CXFULLSCREEN), 
		::GetSystemMetrics(SM_CYFULLSCREEN));
}

int_32 CScreen::GetWidth()
{
	return ::GetSystemMetrics(SM_CXSCREEN);
}

int_32 CScreen::GetHeight()
{
	return ::GetSystemMetrics(SM_CYSCREEN);
}
